﻿Public Class Form7

    Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
        Dim gamertag As String = TextBox1.Text

        Try
            Dim wb As New WebBrowser
            wb.Navigate("http://www.bungie.net/Stats/Reach/Default.aspx?player=" & gamertag & "&sg=0")
            While (wb.ReadyState <> WebBrowserReadyState.Complete)
                Application.DoEvents()

            End While

            Dim src As Object = wb.Document.GetElementById("ctl00_mainContent_ucPlayerModel_imgModel").GetAttribute("src")
            PictureBox1.ImageLocation = src
        Catch

        End Try
    End Sub

    Private Sub ButtonX2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX2.Click
        Dim savefiledialog1 As New SaveFileDialog
        Try

        Catch ex As Exception

        End Try
        savefiledialog1.Title = "Save File"
        savefiledialog1.FileName = "*.bmp"
        savefiledialog1.Filter = "Bitmap |*.bmp"
        If savefiledialog1.ShowDialog() = DialogResult.OK Then
            PictureBox1.Image.Save(savefiledialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
        End If
    End Sub
End Class